#ifndef _CRT_UTF8_H_
#define _CRT_UTF8_H_

#include <crt_core.hpp>

#ifdef __cplusplus
extern "C" {
#endif

int is_utf8(const char* str, size_t length);

// sizeof(wchar_t)
// linux == 4
// win == 2
size_t wchar_to_char_s(const wchar_t* in, size_t inlen, char* out, size_t outlen);
size_t char_to_wchar_s(const char* in, size_t len, wchar_t* out, size_t outlen);

// malloc you must free ptr
char* wchar_to_char(const wchar_t* in, size_t len);
// malloc you must free ptr
wchar_t* char_to_wchar(const char* in, size_t len);

char* wchar_to_localechar(const wchar_t* in, size_t len, const char* locale);

wchar_t* char_to_localewchar(const char* in, size_t len, const char* locale);

#ifdef __cplusplus
}
#endif

#endif
